<template>
  <div>
    <ul>
      <li v-for="item in goodsList" :key="item.id" @click="goToDetail(item.id)">
        <img :src="item.list_pic_url" alt="" width="100%">
        <div class="title van-ellipsis">{{item.name}}</div>
        <div class="price">{{item.retail_price | PriceFormat}}</div>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: "ProductList",
  props:['goodsList'],
  data() {
    return {
    }
  },
  methods:{
    goToDetail(id){
      this.$router.push({
        path:'/productdetail',
        query:{
          'id':id
        }
      })
    }
  }
}
</script>

<style lang="less" scoped>
ul {
  padding: .1rem 2%;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;

  li {
    /* 一半 */
    width: 49%;
    background-color: #fff;
    margin-bottom: .1rem;
    text-align: center;
    line-height: .25rem;
    .price {
      color:darkred;
    }
  }
}
</style>